<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>访问器伪造属性操作</title>
</head>
<body>
    <script>
        // 'use strict'
        let lesson = {
            lists : [
                {name:"html",price:88},
                {name:"css",price:99},
                {name:"js",price:199},
            ],
            get total(){
                return this.lists.reduce((t,c) => {
                    return t += c.price;
                },0);
            }
        };
        console.log(lesson.total);
        // 不可以修改total的值，严格模式下会报错
        lesson.total = 88;
        console.log(lesson.total);
    </script>
</body>
</html>